import { Component, OnInit, EventEmitter, ViewEncapsulation } from '@angular/core';
import { Observable } from "rxjs/Observable";
import { ReplaySubject } from "rxjs/ReplaySubject";
import { CmHttp } from "http-module";

@Component({
  // moduleId: module.id,
  selector: 'stock-ts',
  templateUrl: 'stock-ts.component.html',
  encapsulation: ViewEncapsulation.None,
  styleUrls: [
    "stock-ts.component.less"
  ],
  inputs: [
    "stockSource"
  ]
})
export class StockTsComponent implements OnInit {
  reportSource = new ReplaySubject(1);
  currentTabSource = new ReplaySubject(1);
  stockSource;
  currentTab;
  tabList = [
    {
      text: "财",
      type: "report",
    },
    {
      text: "上",
      type: "chart",
      symbol: "000001.SS"
    },
    {
      text: "深",
      type: "chart",
      symbol: "399001.SZ"
    },
    {
      text: "创",
      type: "chart",
      symbol: "399006.SZ"
    },
  ]

  constructor(private http: CmHttp) { }

  ngOnInit() {
    this.stockSource.subscribe(this.reportSource);
  }

  onTabClick(tab) {
    this.currentTab = tab;
    this.currentTabSource.next(tab);
  }

}